package com.qqpz.sign_project.service.impl;

import com.qqpz.sign_project.entity.Records;
import com.qqpz.sign_project.mappers.RecordsMapper;
import com.qqpz.sign_project.service.RecordsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.RequestMapping;

import java.util.List;

@Service
public class RecordsServiceImpl implements RecordsService {
    @Autowired
    private RecordsMapper recordsMapper;

    @Override
    public List<Records> queryAllRecords() {

        return recordsMapper.queryAllRecords();
    }

    @Override
    public Records queryRecordsById(String id) {
        return recordsMapper.queryRecordsById(id);
    }

    @Override
    public List<Records> queryRecordsByUserId(String userId) {
        return recordsMapper.queryRecordsByUserId(userId);
    }

    @Override
    public Records queryRecordsByUserIdAndCourseId(String userId, String courseId) {
        return recordsMapper.queryRecordsByUserIdAndCourseId(userId,courseId);
    }

    @Override
    public List<Records> queryRecordsByType(int type) {
        return recordsMapper.queryRecordsByType(type);
    }

    @Override
    public List<Records> queryRecordsByStatus(int status) {
        return recordsMapper.queryRecordsByStatus(status);
    }

    @Override
    public List<Records> queryRecordsByCourseId(String courseId) {
        return recordsMapper.queryRecordsByCourseId(courseId);
    }

    @Override
    @Transactional(rollbackFor = Exception.class)
    public int updateRecordsById(Records records) {
        return recordsMapper.updateRecordsById(records);
    }

    @Override
    @Transactional(rollbackFor = Exception.class)
    public int updateScoresByUidCid(Records records) {
        return recordsMapper.updateScoresByUidCid(records);
    }

    @Override
    @Transactional(rollbackFor = Exception.class)
    public int updateTypeByUidCid(Records records) {
        return recordsMapper.updateTypeByUidCid(records);
    }

    @Override
    @Transactional(rollbackFor = Exception.class)
    public int updateCommentsByUidCid(Records records) {
        return recordsMapper.updateCommentsByUidCid(records);
    }

    @Override
    @Transactional(rollbackFor = Exception.class)
    public int updateStatusByUidCid(Records records) {
        return recordsMapper.updateStatusByUidCid(records);
    }

    @Override
    @Transactional(rollbackFor = Exception.class)
    public int deleteRecordsById(String id) {
        return recordsMapper.deleteRecordsById(id);
    }

    @Override
    @Transactional(rollbackFor = Exception.class)
    public int deleteRecordsByUserId(String id) {
        return recordsMapper.deleteRecordsByUserId(id);
    }

    @Override
    @Transactional(rollbackFor = Exception.class)
    public int deleteRecordsByCourseId(String id) {
        return recordsMapper.deleteRecordsByCourseId(id);
    }

    @Override
    @Transactional(rollbackFor = Exception.class)
    public int createRecords(Records records) {
        return  recordsMapper.createRecords(records);
    }

//    @Override
//    public void insertByUserId(Records records) {
//        recordsMapper.insertByUserId(records);
//    }
}
